package com.kirk.cts.ui.view.panel;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.swing.*;
import java.awt.*;

/**
 * <p> ViewDeatilPanel.java </p>
 *
 * @version 1.0.0
 * @Author kirkliu
 * @Date 2020-09-01 22:20
 * @Description 显示内容详细
 */
@Component("viewDeatilPanel")
@Scope("prototype")
public class ViewDeatilPanel extends JPanel {
    private static final long serialVersionUID = 1L;
    private JEditorPane containerPanel;

    public ViewDeatilPanel() {
        super();
        init();
    }

    private void init() {
        BorderLayout layout = new BorderLayout();
        this.setLayout(layout);
        containerPanel = new JEditorPane();
        containerPanel.setEditable(false);
        containerPanel.setContentType("text/html");
        JScrollPane topScrollPane = new JScrollPane(containerPanel);
        this.add(topScrollPane, BorderLayout.CENTER);
    }

    /**
     * 显示内容
     */
    public void showContent(String content) {
        containerPanel.setText(content);
    }
}
